package com.biz.controller.community;

import com.biz.model.Pmodel.base.PsysDynamic;
import com.biz.service.MService.user.UserServiceI;
import com.framework.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author lzq
 *
 */
@Controller
@RequestMapping(value="/community")
public class CommunityController extends BaseController{

	@Resource(name = "userService")
	private UserServiceI userService;
	/**
	 * 跳转社区介绍
	 */
	@RequestMapping(value="/toIntroduce")
	public ModelAndView toIntroduce()throws Exception{
		mv.clear();
		mv.setViewName("community/community");

		return mv;
	}


	/**
	 * 跳转社区动态
	 */
	@RequestMapping(value="/toDynamic")
	public ModelAndView toDynamic()throws Exception{
		mv.clear();
		List<PsysDynamic> listD = userService.getPsysDynamicList();

		mv.addObject("listD",listD);
		mv.setViewName("community/dynamicList");
		return mv;
	}

	/**
	 * 跳转社区动态详情
	 */
	@RequestMapping(value="/toDetail")
	public ModelAndView toDetail(String detailId)throws Exception{
		mv.clear();
		PsysDynamic psysDynamic = userService.getPsysDynamicById(detailId);
		mv.addObject("psysDynamic",psysDynamic);
		mv.setViewName("community/dynamicDetail");
		return mv;
	}

}
